/*
 * Copyright (C) 2008 The Android Open Source Project
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

 /** @defgroup utime Utime
 * @ingroup libc
 */

#ifndef _UTIME_H_
#define _UTIME_H_

#include <sys/cdefs.h>
#include <sys/types.h>
#ifndef __LITEOS__
#include <linux/utime.h>
#else
#include <liteos/utime.h>
#endif

#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */

/**
* @ingroup utime
*
* @par Description:
* The utime() function shall set the modification times of the file named by the path argument.
* If times is a null pointer, the modification times of the file shall be set to the current time.
* If times is not a null pointer, times shall be interpreted as a pointer to a utimbuf structure and
* modification times shall be set to the values contained in the designated structure.
*
* @attention
* <ul>
* <li>The utime() doesn't support to set access time.</li>
* <li>Now only fat filesystem support this function.</li>
* </ul>
*
* @retval #0  On success.
* @retval #-1 On failure with errno set.
*
* @par Errors
* <ul>
* <li><b>EINVAL</b>: The path is a null pointer or the ptimes is a invalid value.</li>
* <li><b>ENAMETOOLONG</b>: The length of a component of a pathname is longer than {NAME_MAX}.</li>
* <li><b>ENOENT</b>: A component of the path does not exist.</li>
* <li><b>ENOSYS</b>: The file system doesn't support this function.</li>
* <li><b>EACCES</b>: It is a read-only file system.</li>
* <li><b>ENOMEM</b>: Out of memory.</li>
* <li><b>EIO</b>: A hard error occurred in the low level disk I/O layer or the physical drive cannot work.</li>
* </ul>
*
* @par Dependency:
* <ul><li>utime.h</li></ul>
* @see fstat
* @since Huawei LiteOS V100R001C00
*/
extern int utime(const char *path, const struct utimbuf *ptimes);


#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

#endif /* _UTIME_H_ */
